{extend name='admin@public/content'}

{block name="content"}

<!-- 表单搜索 开始 -->
<form autocomplete="off" class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get">

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">账户信息</label>
        <div class="layui-input-inline">
            <input name="mobile" value="{$Think.get.mobile|default=''}" placeholder="用户手机号" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">账户信息</label>
        <div class="layui-input-inline">
            <input name="mobile" value="{$Think.get.mobile|default=''}" placeholder="手机号" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">ref</label>
        <div class="layui-input-inline">
            <input name="ref" value="{$Think.get.ref|default=''}" placeholder="ref" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">sid</label>
        <div class="layui-input-inline">
            <input name="sid" value="{$Think.get.sid|default=''}" placeholder="sid" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">用户来源</label>
        <div class="layui-input-inline">
            <select name="user_type" class="layui-select">
                <option value="">用户来源</option>
                <!--{foreach [1=>"安卓",2=>"ios",10=>"微信h5",11=>"手机号h5"] as $k=>$v}-->
                {if $Think.get.user_type eq "$k"}
                <option selected="selected" value="{$k}">{$v}</option>
                {else}
                <option value="{$k}">{$v}</option>
                {/if}
                <!--{/foreach}-->
            </select>
        </div>
    </div>
    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">创建时间</label>
        <div class="layui-input-inline">
            <input name="date" id="range-date" value="{$Think.get.date}" placeholder="请选择创建时间" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item layui-inline">
        <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
    </div>

</form>

<script>
    window.laydate.render({range: true, elem: '#range-date'});
    window.form.render();
</script>
<!-- 表单搜索 结束 -->
<b>充值总计：</b><span class="layui-badge">{$count}</span>
<b>充值人数：</b><span class="layui-badge">{$sum_p}</span>
<form autocomplete="off" onsubmit="return false;" data-auto="true" method="post">
    {if empty($list)}
    <p class="help-block text-center well">没 有 记 录 哦！</p>
    {else}
    <input type="hidden" value="resort" name="action"/>
    <table class="layui-table" lay-skin="line" lay-size="sm">
        <thead>
        <tr>
            <th class='text-left nowrap'>ID</th>
            <th class='text-left nowrap'>手机号</th>
            <th class='text-left nowrap'>来源</th>
            <th class='text-left nowrap'>邀请码</th>
            <th class='text-left nowrap'>
                <span>币</span>
                <span class="layui-table-sort layui-inline">
                    <i class="layui-edge layui-table-sort-asc" data-coin="asc" title="升序"></i>
                    <i class="layui-edge layui-table-sort-desc" data-coin="desc" title="降序"></i>
                </span>
            </th>
            <th class='text-left nowrap'>
                <span>积分</span>
                <span class="layui-table-sort layui-inline">
                    <i class="layui-edge layui-table-sort-asc" data-integral="asc" title="升序"></i>
                    <i class="layui-edge layui-table-sort-desc" data-integral="desc" title="降序"></i>
                </span>
            </th>
            <th class='text-left nowrap'>
                <span>充值总金额</span>
                <span class="layui-table-sort layui-inline">
                    <i class="layui-edge layui-table-sort-asc" data-money="asc" title="升序"></i>
                    <i class="layui-edge layui-table-sort-desc" data-money="desc" title="降序"></i>
                </span>
            </th>
            <th class='text-left nowrap'>
                <span>消费总币数</span>
                <span class="layui-table-sort layui-inline">
                    <i class="layui-edge layui-table-sort-asc" data-consume="asc" title="升序"></i>
                    <i class="layui-edge layui-table-sort-desc" data-consume="desc" title="降序"></i>
                </span>
            </th>
            <th class='text-left nowrap'>
                <span>阅读币</span>
                <span class="layui-table-sort layui-inline">
                    <i class="layui-edge layui-table-sort-asc" data-read="asc" title="升序"></i>
                    <i class="layui-edge layui-table-sort-desc" data-read="desc" title="降序"></i>
                </span>
            </th>
            <th class='text-left nowrap'>创建时间</th>
            <th class='text-left nowrap'></th>
        </tr>
        </thead>
        <tbody>
        {foreach $list as $key=>$vo}
        <tr>
            <td class='text-left text-top nowrap'>{$vo.id}</td>
            <td class='text-left text-top nowrap'>{$vo.mobile|default='<span class="color-desc">未设置</span>'|raw}</td>
            <td class='text-left text-top nowrap'>
                {$vo.ref|default=''|raw}
                {$vo.sid|default=''|raw}
            </td>
            <td class='text-left text-top nowrap'>{$vo.referer_code}</td>
            <td class='text-left text-top nowrap'>{$vo.coin_balance}</td>
            <td class='text-left text-top nowrap'>{$vo.integral}</td>
            <td class='text-left text-top nowrap'>{$vo.money_sum}</td>
            <td class='text-left text-top nowrap'>{$vo.consume_coin}</td>
            <td class='text-left text-top nowrap'>{$vo.read_coin}</td>
            <td class='text-left text-top nowrap'>{$vo.create_time|date="Y-m-d H:i:s"}</td>
            <td class='text-left text-top nowrap'>
                <span class="text-explode">|</span>
                <a data-title="消费明细" data-open="{:url('consume/index')}?uid={$vo.id}">消费明细</a>
                <span class="text-explode">|</span>
                <a data-title="充值明细" data-open="{:url('recharge/index')}?uid={$vo.id}">充值明细</a>
                <span class="text-explode">|</span>
                <a data-title="订单明细" data-open="{:url('order/index')}?uid={$vo.id}">订单明细</a>
            </td>
        </tr>
        {/foreach}
        </tbody>
    </table>
    {if isset($page)}<p>{$page|raw}</p>{/if}
    {/if}
</form>

<script>
    require(['jquery'], function () {
        // 应用创建与初始化
        $('[data-coin]').on('click', function () {
            window.location.href = "http://{:env('admin_host')}{:resultUrl('user/index')}&field=coin_balance&sort="+$(this).data('coin');
        });
        $('[data-integral]').on('click', function () {
            window.location.href = "http://{:env('admin_host')}{:resultUrl('user/index')}&field=integral&sort="+$(this).data('integral');
        });
        $('[data-money]').on('click', function () {
            window.location.href = "http://{:env('admin_host')}{:resultUrl('user/index')}&field=money_sum&sort="+$(this).data('money');
        });
        $('[data-consume]').on('click', function () {
            window.location.href = "http://{:env('admin_host')}{:resultUrl('user/index')}&field=consume_coin&sort="+$(this).data('consume');
        });
        $('[data-read]').on('click', function () {
            window.location.href = "http://{:env('admin_host')}{:resultUrl('user/index')}&field=read_coin&sort="+$(this).data('read');
        });
    });
</script>
{/block}